<form class="form-horizontal" name="taskForm" ng-submit="addTask()" novalidate>
    <div class="modal-header bg-primary">
        <h3 class="modal-title">{{action}} task</h3>
    </div>
    <div class="modal-body">
        <div class="form-group" ng-class="{ 'has-error' : taskForm.name.$invalid && !taskForm.name.$pristine }">
            <label class="col-md-3 control-label">Task title
                <i class="fa fa-asterisk text-danger"></i>
            </label>
            <div class="col-md-9">
                <input class="form-control" ng-model="task.title" placeholder="Task title" required type="text">
            </div>
        </div>

        <div class="form-group" ng-class="{ 'has-error' : taskForm.group.$invalid && !taskForm.group.$pristine }">
            <label class="col-md-3 control-label">Task group
                <i class="fa fa-asterisk text-danger"></i>
            </label>
            <div class="col-md-9">
                <input class="form-control" ng-model="task.group" placeholder="Task group" required type="text"
                    uib-typeahead="g for g in groups | filter:$viewValue"
                    typeahead-min-length="0">
            </div>
        </div>

        <div class="form-group" ng-class="{ 'has-error' : taskForm.description.$invalid && !taskForm.description.$pristine }">
            <label class="col-md-3 control-label">Task description</label>
            <div class="col-md-9">
                <textarea name="content" class="content-box" markdown-editor="{'iconlibrary': 'fa', addExtraButtons: true, resize: 'vertical'}" rows="10" ng-model="task.description"></textarea>

                <p class="help-block small">Task's default description</p>
            </div>
        </div>

        <div class="form-group">
            <label class="col-md-3 control-label">Assignee</label>
            <div class="col-md-9">
                <select class="form-control" ng-model="task.owner"
                    ng-options="item.login as item.name for item in users | orderBy:'login'">
                    <option value="" selected>-- Select assignee --</option>
                </select>
            </div>
        </div>
    </div>
    <div class="modal-footer text-left">
        <button class="btn btn-default" ng-click="cancel()" type="button">Cancel</button>
        <button class="btn btn-primary pull-right" ng-disabled="taskForm.$invalid" type="submit">{{action}} task</button>
    </div>
</form>
